//
//  MeService.m
//  SinaWebo
//
//  Created by wwj on 16/1/20.
//  Copyright © 2016年 亦心. All rights reserved.
//

#import "MeService.h"
#import "HttpURL.h"
#import "HttpUtil.h"
#import <MJExtension.h>

@implementation MeService

+(void)getUserMessageWithRequest:(MeRequest *)request success:(void (^)(MeResponse *))success error:(void (^)(NSError *))error{
    [HttpUtil getWithURL:getUserMessageURL params:request.mj_keyValues success:^(id responseObject) {
        if (success) {
            MeResponse *data = [MeResponse mj_objectWithKeyValues:responseObject];
            success(data);
        }
    } failure:^(NSError *failure) {
        if (error) {
            error(failure);
        }
    }];
    
}

+ (void)getMeSettingWithRequest:(MeSettingRequest *)request success:(void (^)(MeSettingResponse *))success error:(void (^)(NSError *))error{
    [HttpUtil getWithURL:getMeSettingURL params:request.mj_keyValues success:^(id responseObject) {
        if (success) {
            MeSettingResponse *data = [MeSettingResponse mj_objectWithKeyValues:responseObject];
            success(data);
        }
    } failure:^(NSError *failure) {
        if (error) {
            error(failure);
        }
    }];
}

+ (void)getUserCenterWithRequest:(UserCenterRequest *)request success:(void (^)(UserCenterResponse *))success error:(void (^)(NSError *))error{
    [HttpUtil getWithURL:getMeSettingURL params:request.mj_keyValues success:^(id responseObject) {
        if (success) {
            UserCenterResponse *data = [UserCenterResponse mj_objectWithKeyValues:responseObject];
            success(data);
        }
    } failure:^(NSError *failure) {
        if (error) {
            error(failure);
        }
    }];
}

@end
